#include "entitiestab.h"


EntitiesTab::EntitiesTab(QTableView* entview,QWidget *parent) :
    QWidget(parent),m_entview(entview)
{
    QVBoxLayout* main_layout = new QVBoxLayout;
    QHBoxLayout* buttons_layout = new QHBoxLayout;

    QPushButton* add_button = new QPushButton("Add");
    QPushButton* copy_button = new QPushButton("Copy");
    QPushButton* remove_button = new QPushButton("Remove Selected");

    buttons_layout->addWidget(add_button);
    buttons_layout->addWidget(remove_button);

    main_layout->addLayout(buttons_layout);
    main_layout->addWidget(m_entview);
    m_entview->horizontalHeader()->setResizeMode(QHeaderView::Stretch);

    this->setLayout(main_layout);

    connect(add_button,SIGNAL(clicked()),this,SLOT(Add()));
    connect(copy_button,SIGNAL(clicked()),this,SLOT(Copy()));
    connect(remove_button,SIGNAL(clicked()),this,SLOT(Delete()));
}

void EntitiesTab::Add(){
    emit AddPressed();
}

void EntitiesTab::Copy(){
    emit CopyPressed();
}

void EntitiesTab::Delete(){
    emit DeletePressed();
}
